package com.tianyiyan.tyenword;

import com.opensymphony.xwork2.Action;
import com.tianyiyan.dao.tyenword.UserDao;
import com.tianyiyan.dao.tyenword.UserDao.ResultType;

public class EmailVerificationAction implements Action
{
	private String code;
	private String result;
	public String getResult() {
		return result;
	}
	public void setResult(String result) {
		this.result = result;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	@Override
	public String execute() throws Exception {
		if (code.isEmpty())
			result = "error";
		UserDao dao = new UserDao();
		ResultType rType = dao.emailVerification(code);
		if (rType == ResultType.SUCCESS)
			result = "success";
		else if (rType == ResultType.OVERDUE)
			result = "overdue";
		else
			result = "error";
		return SUCCESS;
	}

}
